<div id="wrapper">
    <div id="page-wrapper">
        <div class="panel panel-primary">
            <div class="panel-heading"><h5 class="panel-title"></h5></div>
            <div class="panel-body">
                <div id="toolbar" class="ms-toolbar">
                    <button id="toolbar-add" class="btn btn-danger" data-toggle="modal"
                            data-target="#addflashsaleModal">
                        <span class="glyphicon glyphicon-plus"></span> 增加
                    </button>
                </div>
                <div class="modal fade" id="addflashsaleModal" role="dialog">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">&times;</button>
                                <h4 class="modal-title">增加秒杀</h4>
                            </div>
                            <div class="modal-body">
                                <form id='addflashsaleForm' class="form-horizontal" role="form"
                                      enctype="multipart/form-data">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">名称</label>

                                        <div class="col-sm-10">
                                            <input name='title' type="text" class="form-control" placeholder="请勿使用特殊字符">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">描述</label>

                                        <div class="col-sm-10">
                                            <input name='description' type="text" class="form-control"
                                                   placeholder="请勿使用特殊字符">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品名称</label>

                                        <div class="col-sm-10">
                                            <select name='goods_id' id="goods_id" class="form-control"
                                                    style="width:100%;"></select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">价格</label>

                                        <div class="col-sm-10">
                                            <input name='price' type="text" class="form-control" placeholder="两位小数">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">商品数量</label>

                                        <div class="col-sm-10">
                                            <input name='goods_num' type="text" class="form-control" placeholder="注意库存">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">限购数量</label>

                                        <div class="col-sm-10">
                                            <input name='buy_limit' type="text" class="form-control"
                                                   placeholder="请设置小于总数量">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">开始时间</label>

                                        <div class="col-sm-10">
                                            <input id="start_time" name='start_time' type="text" class="form-control">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">结束时间</label>

                                        <div class="col-sm-10">
                                            <input id="end_time" name='end_time' type="text" class="form-control">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button id="close" type="button" class="btn btn-primary" data-dismiss="modal">关闭
                                </button>
                                <button id="add_confirm" type="button" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <table id="flashsaletable" class="table table-bordered">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>名称</th>
                            <th>简介</th>
                            <th>商品ID</th>
                            <th>商品名称</th>
                            <th>价格</th>
                            <th>数量</th>
                            <th>限额</th>
                            <th>已售</th>
                            <th>已下单</th>
                            <th>是否结束</th>
                            <th>开始时间</th>
                            <th>结束时间</th>
                            <th>编辑</th>
                            <th>删除</th>
                        </tr>
                        </thead>
                        <tbody>
                        {%notempty name="$data"%}
                        {%volist name="$data->toArray()['data']" id="vo"%}
                        <tr id="region{%$vo.id%}">
                            <td>{%$vo.id%}</td>
                            <td>{%$vo.title%}</td>
                            <td>{%$vo.description%}</td>
                            <td>{%$vo.goods_id%}</td>
                            <td>{%$vo.goods_name%}</td>
                            <td>{%$vo.price%}</td>
                            <td>{%$vo.goods_num%}</td>
                            <td>{%$vo.buy_limit%}</td>
                            <td>{%$vo.buy_num%}</td>
                            <td>{%$vo.order_num%}</td>
                            <td>
                                {%switch name="$vo.is_end"%}
                                {%case value="0"%}否{%/case%}
                                {%case value="1"%}是{%/case%}
                                {%/switch%}
                            </td>
                            <td>{%$vo.start_time%}</td>
                            <td>{%$vo.end_time%}</td>
                            <td class="editflashsale">
                                <button class="btn btn-danger btn-sm">编辑</button>
                            </td>
                            <td class="delflashsale">
                                <button class="btn btn-danger btn-sm">删除</button>
                            </td>
                        </tr>
                        {%/volist%}
                        </tbody>
                    </table>
                    <div class="pull-right">
                        {%$data->render()%}
                    </div>
                    {%/notempty%}
                </div>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id='deleteModal' tabindex="-1" role="dialog">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">确认删除</h4>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
                <button id="delete_confirm" type="button" class="btn btn-danger">确认</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="editflashsaleModal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">增加秒杀</h4>
            </div>
            <div class="modal-body">
                <form id='editflashsaleForm' class="form-horizontal" role="form" enctype="multipart/form-data">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">ID</label>

                        <div class="col-sm-10">
                            <input name='id' id="edit_id" type="text" class="form-control" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">名称</label>

                        <div class="col-sm-10">
                            <input name='title' id="edit_title" type="text" class="form-control" placeholder="请勿使用特殊字符">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">描述</label>

                        <div class="col-sm-10">
                            <input name='description' id="edit_description" type="text" class="form-control"
                                   placeholder="请勿使用特殊字符">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商品名称</label>

                        <div class="col-sm-10">
                            <select name='goods_id' id="edit_goods_id" class="form-control"
                                    style="width:100%;"></select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">价格</label>

                        <div class="col-sm-10">
                            <input name='price' id="edit_price" type="text" class="form-control" placeholder="两位小数">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商品数量</label>

                        <div class="col-sm-10">
                            <input name='goods_num' id="edit_goods_num" type="text" class="form-control"
                                   placeholder="注意库存">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">限购数量</label>

                        <div class="col-sm-10">
                            <input name='buy_limit' id="edit_buy_limit" type="text" class="form-control"
                                   placeholder="请设置小于总数量">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">开始时间</label>

                        <div class="col-sm-10">
                            <input id="edit_start_time" name='start_time' type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">结束时间</label>

                        <div class="col-sm-10">
                            <input id="edit_end_time" name='end_time' type="text" class="form-control">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
                <button id="edit_confirm" type="button" class="btn btn-primary">提交</button>
            </div>
        </div>
    </div>
</div>

<link rel="stylesheet" type="text/css"
      href="/static/home/vendor/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css">
<script type="text/javascript" src="/static/home/vendor/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"
        charset="UTF-8"></script>
<script type="text/javascript"
        src="/static/home/vendor/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
        charset="UTF-8"></script>
<script src="/static/home/widget/shop/flashsale/flashsale.js"></script>
<script src="/static/home/widget/shop/flashsale/deleteflashsale.js"></script>
<script src="/static/home/widget/shop/flashsale/editflashsale.js"></script>